import state from "@/store/state.js"
export const playerAudio = uni.createInnerAudioContext();
//播放器方法
//播放实例
const playaudio = (val) => {
	playerAudio.autoplay = true;
	playerAudio.src = val.url;
	playerAudio.onPlay(() => {
		console.log("开始播放")
	});
	playerAudio.onError((res) => {
		console.log(res.errMsg);
		console.log(res.errCode);
	});
	playerAudio.onTimeUpdate(() => {
		state.songs.currentimer = playerAudio.currentTime
	})
	playerAudio.onCanplay(() => {
		state.songs.maxtimer = playerAudio.duration.toFixed(2);
		console.log(state.songs.maxtimer);
	});
}
const lyricshighlight = () => {

}
export {
	playaudio,
	lyricshighlight
}
